package com.nowcoder.code.lcof;

public class JZ46 {


    public static void main(String[] args) {

        char a = 'a';
        char a1 = '1';

        System.out.println(new JZ46().solve("100"));

    }

    public int solve(String nums) {
        char[] cs = nums.toCharArray();
        if (cs[0] == '0') {
            return 0;
        }
        int sum = 1;
        int lastsum = 1;
        int lastsum2 = 1;
        boolean last2 = false;
        for (int i = 1; i < cs.length; i++) {
            if (cs[i] == '0') {
                if (cs[i - 1] != '2' && cs[i - 1] != '1') {
                    return 0;
                }
                last2 = false;
                continue;
            }
            boolean b = cs[i - 1] == '1' || (cs[i - 1] == '2' && cs[i] <= '6');
            if (!last2 && b) {
                sum = sum * 2;
            } else if (last2 && b) {
                sum = sum + lastsum2;
            }
            last2 = b;
            lastsum2 = lastsum;
            lastsum = sum;
        }


        return sum;
    }


}
